package com.xzy.sms.web.domain.controller;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.xzy.sms.core.service.ExceptionProcesser;
import com.xzy.sms.core.service.ExceptionProcesser.ExceptionRecorder;

/**
 * 用户控制器
 * 
 * @author macong
 * @since 1.0
 * @version 2014-10-14 macong
 */
@Controller
@RequestMapping(value = "/sms")
public class SmsExceptionController {
    
    /** 日志打印器 */
    protected static Logger logger = LoggerFactory.getLogger(SmsExceptionController.class);
    
    /** FIXME */
    @Autowired
    private ExceptionProcesser exceptionProcesser;
    
    /**
     * 配置信息列表
     * 
     * @param queryLike x
     * @param applicationId xx
     * @param startTime xx
     * @param endTime xx
     * @param sendResult xx
     * @param pageNumber x
     * @param pageSize x
     * @param model x
     * @return 视图
     */
    @RequestMapping(value = "/exception")
    public String pageList(ModelMap model) {
        List<ExceptionRecorder> list = new ArrayList<>();
        Collection<ExceptionRecorder> exs = exceptionProcesser.getExceptions();
        for (ExceptionRecorder ex : exs) {
            list.add(0, ex);
        }
        model.put("list", list);
        return "exception/list";
    }
    
}
